import service from '@/utils/request'

// 生成代码（zip压缩包）
export const useDownloadApi = (tableIds: number[]) => {
	return service.get('/gen/generator/downloadZip?tableIds=' + tableIds.join(','))
}

// 下载到本地
export const useDownloadLocalApi = (id: number) => {
	return service.get('/gen/generator/downloadLocal?tableId=' + id)
}

//代码预览
export const usePreviewApi = (tableId: any) => {
	return service.get('/gen/generator/preview?tableId=' + tableId)
}

//下载单个模板代码
export const useDownloadTemplateApi = (params: any) => {
	location.href =
		import.meta.env.VITE_API_URL + '/gen/generator/download-template-content?tableId=' + params.tableId + '&templateId=' + params.templateId
}

//获取目录树形结构
export const useTreeDataApi = (tableId: number) => {
	return service.get('/gen/generator/tree-data?tableId=' + tableId)
}
